package com.itheima.common.domain;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor(staticName = "of")
public class Result<T> {
    private Integer code;
    private String message;
    private T data;

    public static <T> Result<T> success(T data){
        return Result.of(1, "操作成功", data);
    }
    public static <T> Result<T> error(T data){
        return Result.of(0, "操作失败", null);
    }
    public static <T> Result<T> success(){
        return Result.of(1, "操作成功", null);
    }
}
